[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
##############################################################################
###+---------+################################################################
#+-| F_PUTLN |-------------------------------------+##########################
#| +---------+ Writes output_line to the disk file |##########################
#+-------------------------------------------------+##########################
##############################################################################
##############################################################################
#+--| Summary |----------------+##############################################
#| #INCLUDE fileio.hdr |##############################################
#+-----------------------------+##############################################
##############################################################################
##############################################################################
#+--| Syntax |--------------------------------------------------+#############
#| PROCEDURE f_putln PROTOTYPE |#############
#| PARAMETERS FILE file_stream, CONST CHAR output_line |#############
#+--------------------------------------------------------------+#############
##############################################################################
##############################################################################
########+---| Description |-----------------------------------------+#########
########| The f_putln procedure writes output_line to the disk file |#########
########| associated with file_stream. The file, file_stream must |#########
########| have been opened originally in read only or create mode. |#########
########| --------------------------------------------------------- |#########
########| The carriage-return and line-feed characters are |#########
########| prepended to the output string. Therefore, f_putln is |#########
########| similar to: |#########
########| |#########
########| ? output_line |#########
########+-----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 1 |-------------------------------------------+#########
#########| * file: trimchar.prg |#########
#########| * (** example included with compiler **) |#########
#########| * Remove form feed characters (chr(12)) from a file. |#########
#########| |#########
#########| #include fileio.hdr |#########
#########| PROCEDURE force_main |#########
#########| PARAMETERS CONST CHAR(128) command_line |#########
#########| VARDEF |#########
#########| FILE f |#########
#########| CHAR(128) input_line |#########
#########| BYTE i[128] BASED input_line |#########
#########| CHAR(128) output_line |#########
#########| BYTE o[128] BASED output_line |#########
#########| INT j,k |#########
#########| ENDDEF |#########
#########| |#########
#########| IF .NOT. f_open( f, ltrim( command_line ), &F_READ ) |#########
#########| ? "Unable to open file: ", command_line |#########
#########| QUIT |#########
#########| ENDIF |#########
#########| |#########
#########| DO WHILE .NOT. f_eof( f ) |#########
#########| f_getln( f, c ) |#########
#########| STORE 0 TO j,k |#########
#########| DO WHILE i[j] <> 0 |#########
#########| IF i[j] <> 12 |#########
#########| o[k] = i[j] |#########
#########| k = k + 1 |#########
#########| ENDIF |#########
#########| i = i + 1 |#########
#########| ENDDO |#########
#########| ENDDO |#########
#########| f_close( f ) |#########
#########| ENDPRO |#########
#########| * eof trimff.prg |#########
#########+----------------------------------------------------------+#########
##############################################################################
##############################################################################
#########+--| Example 2 |-------------------------------------------+#########
#########| * Append a program to the autoexec.bat file. |#########
#########| |#########
#########| #include fileio.hdr |#########
#########| PROCEDURE append_auto |#########
#########| VARDEF |#########
#########| FILE auto_file |#########
#########| ENDDEF |#########
#########| |#########
#########| IF .NOT. f_open( auto_file, "\autoexec.bat", ; |#########
#########| &F_APPEND ) |#########
#########| ? "AUTOEXEC.BAT NOT FOUND" |#########
#########| QUIT |#########
#########| ENDIF |#########
#########| f_putln( auto_file, "wbmtf.exe" ) |#########
#########| f_close( auto_file ) |#########
#########| ENDPRO |#########
#########+----------------------------------------------------------+#########
##############################################################################
See Also:
f_close
f_eof()
f_flush
f_getln()
f_open()
f_put
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson